package day16;

import java.util.Arrays;
import java.util.Properties;
import java.util.Random;

public class Demo03 {
	public static void main(String[] args) {
		//		int[] arr = { 22, 43254, 654, 6154, 34, 675, 10 };
		//		System.out.println(Arrays.toString(arr));

		// int[] arr2 = new int[3];
		// System.out.println(Arrays.toString(arr2));
		// System.arraycopy(arr, 0, arr2, 0, 2);
		// System.arraycopy(arr, 0, arr2, 0, 4);
		// System.arraycopy(arr, 5, arr2, 0, 3);
		// System.out.println(Arrays.toString(arr2));

		//		int[] arr3 = Arrays.copyOf(arr, 8);
		//		System.out.println(Arrays.toString(arr3));

		//		int[] arr4 = Arrays.copyOfRange(arr, 3, 8);
		//		System.out.println(Arrays.toString(arr4));

		//		int[] arr = { 1, 4, 7, 9, 12, 34, 35, 46, 77, 78 }; // target: 4
		//		int target = 9;
		// int index = test01(arr, target);
		//		int index = Arrays.binarySearch(arr, target);
		//		System.out.println(index);

		//		Properties p = System.getProperties();
		//		System.out.println(p);

		//		System.out.println(Math.ceil(3.14));
		//		System.out.println(Math.floor(3.14));
		
		Random ran = new Random();
		for (int i = 0; i < 10; i++) {
			System.out.println(ran.nextInt(100) + 1);
		}

	}

	private static int test01(int[] arr, int target) {
		int min = 0, max = arr.length - 1, mid = (min + max) / 2;
		while (arr[mid] != target) {
			if (arr[mid] < target) {
				min = mid + 1;
			} else if (arr[mid] > target) {
				max = mid - 1;
			}
			if (min > max) {
				return -1;
			}
			mid = (min + max) / 2;
		}
		return mid;
	}
}
